﻿
namespace Mbs.Collections
{
    class PropertySetOriginator:IOriginator<IPropertySet>
    {
        public PropertySetOriginator(IPropertySet state)
        {
            State = state;
        }


        public IPropertySet State { get; private set; }

        object IOriginator.CreateMemento()
        {
            return new PropertySet(State);
        }

        void IOriginator.RestoreMemento(object memento)
        {
            RestoreMemento(memento as IPropertySet);
        }

        public IPropertySet CreateMemento()
        {
            return new PropertySet(State);
        }

        public void RestoreMemento(IPropertySet memento)
        {
            State.Clear();
            State.AddRange(memento);
        }
    }
}
